//
//  CCLayoutConstraint.h
//  CCKit
//
//  Created by tucici on 2019/4/12.
//  Copyright © 2019 tucici. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, CCRelation)
{
    CCLessOrEqual = NSLayoutRelationLessThanOrEqual,
    CCEqual = NSLayoutRelationEqual,
    CCGreaterOrEqual = NSLayoutRelationGreaterThanOrEqual
};
typedef NS_ENUM(NSInteger, CCAttribute)
{
    CCLeft = NSLayoutAttributeLeft,
    CCRight = NSLayoutAttributeRight,
    CCTop = NSLayoutAttributeTop,
    CCBottom = NSLayoutAttributeBottom,
    CCLeading = NSLayoutAttributeLeading,
    CCTrailing = NSLayoutAttributeTrailing,
    CCWidth = NSLayoutAttributeWidth,
    CCHeight = NSLayoutAttributeHeight,
    CCCenterX = NSLayoutAttributeCenterX,
    CCCenterY = NSLayoutAttributeCenterY,
    CCLastBaseline = NSLayoutAttributeLastBaseline,
    CCFirstBaseline = NSLayoutAttributeFirstBaseline,
    CCLeftMargin = NSLayoutAttributeLeftMargin,
    CCRightMargin = NSLayoutAttributeRightMargin,
    CCTopMargin = NSLayoutAttributeTopMargin,
    CCBottomMargin = NSLayoutAttributeBottomMargin,
    CCLeadingMargin = NSLayoutAttributeLeadingMargin,
    CCTrailingMargin = NSLayoutAttributeTrailingMargin,
    CCCenterXWithinMargins = NSLayoutAttributeCenterXWithinMargins,
    CCCenterYWithinMargins = NSLayoutAttributeCenterYWithinMargins,
    CCNotAttribute = NSLayoutAttributeNotAnAttribute
};
typedef NS_OPTIONS(NSInteger, CCAttributeOpitions)
{
    CCOpitionsLeft = 1 << CCLeft,
    CCOpitionsRight = 1 << CCRight,
    CCOpitionsTop = 1 << CCTop,
    CCOpitionsBottom = 1 << CCBottom,
    CCOpitionsLeading = 1 << CCLeading,
    CCOpitionstrailing = 1 << CCTrailing,
    CCOpitionsWidth = 1 << CCWidth,
    CCOpitionsHeight = 1 << CCHeight,
    CCOpitionsCenterX = 1 << CCCenterX,
    CCOpitionsCenterY = 1 << CCCenterY,
    CCOpitionsLastBaseline= 1 << CCLastBaseline,
    CCOpitionsFirstBaseline = 1 << CCFirstBaseline,
    CCOpitionsLeftMargin = 1 << CCLeftMargin,
    CCOpitionsRightMargin = 1 << CCRightMargin,
    CCOpitionsTopMargin = 1 << CCTopMargin,
    CCOpitionsBottomMargin = 1 << CCBottomMargin,
    CCOpitionsLeadingMargin = 1 << CCLeadingMargin,
    CCOpitionsTrailingMargin = 1 << CCTrailingMargin,
    CCOpitionsCenterXWithinMargins = 1 << CCCenterXWithinMargins,
    CCOpitionsCenterYWithinMargins = 1 << CCCenterYWithinMargins,
};

@interface CCLayoutConstraint : NSLayoutConstraint
/**
 简化+(instancetype)constraintWithItem:(id)view1 attribute:(NSLayoutAttribute)attr1 relatedBy:(NSLayoutRelation)relation toItem:(nullable id)view2 attribute:(NSLayoutAttribute)attr2 multiplier:(CGFloat)multiplier constant:(CGFloat)c;
 
 @param view1 添加约束的view
 @param attr1 添加的约束
 @param r 与参照的view的关系
 @param view2 参照的view
 @param attr2 参照的view上，具体参照的约束
 @param m 倍数关系
 @param c 常量,约束值
 @return return 约束
 */
+ (instancetype)a:(nonnull id)view1 attr:(CCAttribute)attr1 r:(CCRelation)r b:(nullable id)view2 attr:(CCAttribute)attr2 m:(CGFloat)m c:(CGFloat)c;

@end

NS_ASSUME_NONNULL_END
